package tracks.client.map;

import com.google.gwt.maps.client.MapWidget;

public class MapController {

	/**
	 * This isn't thread safe, so do some research to find out the proper
	 * mechanism. Or convince yourself that you don't need thread safety, which
	 * may be the case.
	 */
	private static MapController instance = new MapController();

	/** Google Map */
	private final MapWidget map;

	/** Notifier for map events */
	private final MapEventNotifier eventNotifier;

	/** Singleton retrieval */
	public static MapController getInstance() {
		return instance;
	}

	/**
	 * Private modifier to defeat external instantiation for singleton class.
	 */
	private MapController() {
		map = new MapWidget();
		eventNotifier = new MapEventNotifier();
	}

	/**
	 * Get the map.
	 * 
	 * @return the map.
	 */
	public MapWidget getMap() {
		return map;
	}

	/**
	 * Get the <tt>MapEventNotifier</tt>.
	 * 
	 * @return the map event notifier.
	 */
	public MapEventNotifier getMapEventNotifier() {
		return eventNotifier;
	}

}
